﻿using System;
using System.IO;
using System.Windows;

namespace Engine.FileFormats3D.C11Undercover
{
    public class C11UcPrcFile : DependencyObject
    {
        //public string TestID { get { return "This is my test"; } }

        #region Public Fields

        // Using a DependencyProperty as the backing store for TestID.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TestIDProperty =
            DependencyProperty.Register("TestID", typeof(string), typeof(C11UcPrcFile), null);

        #endregion Public Fields

        #region Public Properties

        public float AmbExtra { get; set; }

        public float AmbNDiff { get; set; }

        public float AmbObHB { get; set; }

        public float AmbObHG { get; set; }

        public float AmbObHR { get; set; }

        public float AmbObj { get; set; }

        public float AmbObjB { get; set; }

        public float AmbObjG { get; set; }

        public float AmbObjR { get; set; }

        public float AmbObLB { get; set; }

        public float AmbObLG { get; set; }

        public float AmbObLR { get; set; }

        public float AmbScn { get; set; }

        public float AmbScnB { get; set; }

        public float AmbScnG { get; set; }

        public float AmbScnR { get; set; }

        public float AmbTrx { get; set; }

        public float AmbTrxB { get; set; }

        public float AmbTrxG { get; set; }

        public float AmbTrxR { get; set; }

        public float Bloom { get; set; }

        public float ColBlend { get; set; }

        public int Compress { get; set; }

        public float Contrast { get; set; }

        public float DrLnAlph { get; set; }

        public float DrLnBrgt { get; set; }

        public float ExpLevel { get; set; }

        public float ExpoFin { get; set; }

        public float Exposure { get; set; }

        public float FireColB { get; set; }

        public float FireColG { get; set; }

        public float FireColR { get; set; }

        public float FogColB { get; set; }

        public float FogColG { get; set; }

        public float FogColR { get; set; }

        public float FogLevel { get; set; }

        public float GrassAmb { get; set; }

        public float GrassSun { get; set; }

        public float GrsAmbB { get; set; }

        public float GrsAmbG { get; set; }

        public float GrsAmbR { get; set; }

        public float GrsSunB { get; set; }

        public float GrsSunG { get; set; }

        public float GrsSunR { get; set; }

        public float IllumB { get; set; }

        public float IllumCol { get; set; }

        public float IllumG { get; set; }

        public float IllumR { get; set; }

        public float MirrorB { get; set; }

        public float MirrorG { get; set; }

        public float MirrorR { get; set; }

        public float MoBlurFa { get; set; }

        public float SkyCol1B { get; set; }

        public float SkyCol1G { get; set; }

        public float SkyCol1R { get; set; }

        public float SkyCol2B { get; set; }

        public float SkyCol2G { get; set; }

        public float SkyCol2R { get; set; }

        public float SkyLevel { get; set; }

        public float SkyRefl { get; set; }

        public float SkyRotat { get; set; }

        public float SmokColB { get; set; }

        public float SmokColG { get; set; }

        public float SmokColR { get; set; }

        public float Sun { get; set; }

        public float SunColB { get; set; }

        public float SunColG { get; set; }

        public float SunColR { get; set; }

        public float SunIblB { get; set; }

        public float SunIblG { get; set; }

        public float SunIblR { get; set; }

        public float SunLevel { get; set; }

        public float SunLvIbl { get; set; }

        public string TestID
        {
            get { return (string)GetValue(TestIDProperty); }
            set { SetValue(TestIDProperty, value); }
        }

        public int TexDeCol { get; set; }

        public float WlkAmbB { get; set; }

        public float WlkAmbG { get; set; }

        public float WlkAmbR { get; set; }

        public float WolkAmb { get; set; }

        public float WolkSun { get; set; }

        #endregion Public Properties

        #region Public Methods

        public static C11UcPrcFile FromFile(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fs);
            C11UcPrcFile c11UcPrcFile = new C11UcPrcFile();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.Exposure = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.ExpLevel = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.ExpoFin = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.Contrast = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.Compress = br.ReadInt32();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.TexDeCol = br.ReadInt32();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunColR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunColG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunColB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunLevel = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunIblR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunIblG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunIblB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SunLvIbl = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbScnR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbScnG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbScnB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbScn = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObjR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObjG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObjB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObj = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbTrxR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbTrxG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbTrxB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbTrx = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbExtra = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbNDiff = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObLR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObLG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObLB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObHR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObHG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.AmbObHB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsAmbR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsAmbG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsAmbB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrassAmb = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsSunR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsSunG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrsSunB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.GrassSun = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.WlkAmbR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.WlkAmbG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.WlkAmbB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.WolkAmb = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.WolkSun = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FireColR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FireColG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FireColB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SmokColR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SmokColG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SmokColB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.IllumR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.IllumG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.IllumB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.IllumCol = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FogColR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FogColG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FogColB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.FogLevel = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol1R = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol1G = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol1B = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol2R = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol2G = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyCol2B = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyLevel = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyRefl = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.SkyRotat = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.ColBlend = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.MirrorR = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.MirrorG = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.MirrorB = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.DrLnBrgt = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.DrLnAlph = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.Bloom = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.MoBlurFa = br.ReadSingle();

            br.BaseStream.Position += 32; // overjump text
            c11UcPrcFile.Sun = br.ReadSingle();

            if (br.BaseStream.Position != 2844)
                throw new Exception("File not read to end");

            br.Close();
            fs.Close();

            return c11UcPrcFile;
        }

        public void ToFile(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
            BinaryWriter bw = new BinaryWriter(fs);

            char[] textArray = new char[32];
            char[] emptyArray = new char[32];

            emptyArray.CopyTo(textArray, 0);
            "Exposure".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.Exposure);

            emptyArray.CopyTo(textArray, 0);
            "ExpLevel".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.ExpLevel);

            emptyArray.CopyTo(textArray, 0);
            " ExpoFin".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.ExpoFin);

            emptyArray.CopyTo(textArray, 0);
            "Contrast".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.Contrast);

            emptyArray.CopyTo(textArray, 0);
            "Compress".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((int)this.Compress);

            emptyArray.CopyTo(textArray, 0);
            "TexDeCol".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((int)this.TexDeCol);

            emptyArray.CopyTo(textArray, 0);
            "SunCol-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunColR);

            emptyArray.CopyTo(textArray, 0);
            "SunCol-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunColG);

            emptyArray.CopyTo(textArray, 0);
            "SunCol-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunColB);

            emptyArray.CopyTo(textArray, 0);
            "SunLevel".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunLevel);

            emptyArray.CopyTo(textArray, 0);
            "SunIbl-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)SunIblR);

            emptyArray.CopyTo(textArray, 0);
            "SunIbl-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunIblG);

            emptyArray.CopyTo(textArray, 0);
            "SunIbl-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunIblB);

            emptyArray.CopyTo(textArray, 0);
            "SunLvIbl".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SunLvIbl);

            emptyArray.CopyTo(textArray, 0);
            "AmbScn-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbScnR);

            emptyArray.CopyTo(textArray, 0);
            "AmbScn-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbScnG);

            emptyArray.CopyTo(textArray, 0);
            "AmbScn-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbScnB);

            emptyArray.CopyTo(textArray, 0);
            "AmbScn  ".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbScn);

            emptyArray.CopyTo(textArray, 0);
            "AmbObj-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObjR);

            emptyArray.CopyTo(textArray, 0);
            "AmbObj-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObjG);

            emptyArray.CopyTo(textArray, 0);
            "AmbObj-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)AmbObjB);

            emptyArray.CopyTo(textArray, 0);
            "AmbObj  ".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObj);

            emptyArray.CopyTo(textArray, 0);
            "AmbTrx-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbTrxR);

            emptyArray.CopyTo(textArray, 0);
            "AmbTrx-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbTrxG);

            emptyArray.CopyTo(textArray, 0);
            "AmbTrx-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbTrxB);

            emptyArray.CopyTo(textArray, 0);
            "AmbTrx  ".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbTrx);

            emptyArray.CopyTo(textArray, 0);
            "AmbExtra".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbExtra);

            emptyArray.CopyTo(textArray, 0);
            "AmbNDiff".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbNDiff);

            emptyArray.CopyTo(textArray, 0);
            "AmbObL-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObLR);

            emptyArray.CopyTo(textArray, 0);
            "AmbObL-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObLG);

            emptyArray.CopyTo(textArray, 0);
            "AmbObL-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)AmbObLB);

            emptyArray.CopyTo(textArray, 0);
            "AmbObH-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObHR);

            emptyArray.CopyTo(textArray, 0);
            "AmbObH-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObHG);

            emptyArray.CopyTo(textArray, 0);
            "AmbObH-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.AmbObHB);

            emptyArray.CopyTo(textArray, 0);
            "GrsAmb-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsAmbR);

            emptyArray.CopyTo(textArray, 0);
            "GrsAmb-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsAmbG);

            emptyArray.CopyTo(textArray, 0);
            "GrsAmb-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsAmbB);

            emptyArray.CopyTo(textArray, 0);
            "GrassAmb".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrassAmb);

            emptyArray.CopyTo(textArray, 0);
            "GrsSun-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsSunR);

            emptyArray.CopyTo(textArray, 0);
            "GrsSun-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsSunG);

            emptyArray.CopyTo(textArray, 0);
            "GrsSun-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrsSunB);

            emptyArray.CopyTo(textArray, 0);
            "GrassSun".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.GrassSun);

            emptyArray.CopyTo(textArray, 0);
            "WlkAmb-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.WlkAmbR);

            emptyArray.CopyTo(textArray, 0);
            "WlkAmb-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.WlkAmbG);

            emptyArray.CopyTo(textArray, 0);
            "WlkAmb-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.WlkAmbB);

            emptyArray.CopyTo(textArray, 0);
            " WolkAmb".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.WolkAmb);

            emptyArray.CopyTo(textArray, 0);
            " WolkSun".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.WolkSun);

            emptyArray.CopyTo(textArray, 0);
            "FireColR".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FireColR);

            emptyArray.CopyTo(textArray, 0);
            "FireColG".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FireColG);

            emptyArray.CopyTo(textArray, 0);
            "FireColB".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FireColB);

            emptyArray.CopyTo(textArray, 0);
            "SmokColR".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SmokColR);

            emptyArray.CopyTo(textArray, 0);
            "SmokColG".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SmokColG);

            emptyArray.CopyTo(textArray, 0);
            "SmokColB".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SmokColB);

            emptyArray.CopyTo(textArray, 0);
            " Illum-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.IllumR);

            emptyArray.CopyTo(textArray, 0);
            " Illum-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.IllumG);

            emptyArray.CopyTo(textArray, 0);
            " Illum-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.IllumB);

            emptyArray.CopyTo(textArray, 0);
            "IllumCol".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.IllumCol);

            emptyArray.CopyTo(textArray, 0);
            "FogCol-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FogColR);

            emptyArray.CopyTo(textArray, 0);
            "FogCol-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FogColG);

            emptyArray.CopyTo(textArray, 0);
            "FogCol-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.FogColB);

            emptyArray.CopyTo(textArray, 0);
            "FogLevel".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)FogLevel);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol1R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol1R);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol1G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol1G);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol1B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol1B);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol2R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol2R);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol2G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol2G);

            emptyArray.CopyTo(textArray, 0);
            "SkyCol2B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyCol2B);

            emptyArray.CopyTo(textArray, 0);
            "SkyLevel".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyLevel);

            emptyArray.CopyTo(textArray, 0);
            " SkyRefl".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyRefl);

            emptyArray.CopyTo(textArray, 0);
            "SkyRotat".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.SkyRotat);

            emptyArray.CopyTo(textArray, 0);
            "ColBlend".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.ColBlend);

            emptyArray.CopyTo(textArray, 0);
            "Mirror-R".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.MirrorR);

            emptyArray.CopyTo(textArray, 0);
            "Mirror-G".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.MirrorG);

            emptyArray.CopyTo(textArray, 0);
            "Mirror-B".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.MirrorB);

            emptyArray.CopyTo(textArray, 0);
            "DrLnBrgt".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.DrLnBrgt);

            emptyArray.CopyTo(textArray, 0);
            "DrLnAlph".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.DrLnAlph);

            emptyArray.CopyTo(textArray, 0);
            "   Bloom".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.Bloom);

            emptyArray.CopyTo(textArray, 0);
            "MoBlurFa".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.MoBlurFa);

            emptyArray.CopyTo(textArray, 0);
            "     Sun".ToCharArray().CopyTo(textArray, 0);
            bw.Write(textArray);
            bw.Write((float)this.Sun);

            if (bw.BaseStream.Position != 2844)
                throw new Exception("File should be 2844 Bytes. But it is only " + bw.BaseStream.Position);

            bw.Close();
            fs.Close();
        }

        #endregion Public Methods
    }
}